home *** CD-ROM | disk | FTP | other *** search
- /* File "netstack.cpp", Light Sockets - Copyright (C) Matt Slot, 1996 */
- /* Implementation wrappers for "Light Sockets" network abstraction library. */
-
- #include "stddebug.h"
- #include "stdtypes.h"
-
- #include "netstack.h"
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- NetworkStack::NetworkStack(SocketRef socket) {
- this->socket = socket;
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- NetworkStack::~NetworkStack() {
-
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- #pragma mark -
-
- SocketResult NetworkStack::DoLoad() {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoUnload() {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- #pragma mark -
-
- SocketResult NetworkStack::DoCreate() {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoTickle() {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoDispose() {
- this->socket = 0;
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- #pragma mark -
-
- SocketResult NetworkStack::DoBind(SocketAddressPtr reqAddress,
- SocketAddressPtr retAddress) {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoUnbind() {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- #pragma mark -
-
- SocketResult NetworkStack::DoAddressResolve(Char8 *textAddress,
- SocketAddressPtr socketAddress) {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoAddressLookup(SocketAddressPtr socketAddress,
- Char8 *textAddress) {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- #pragma mark -
-
- SocketResult NetworkStack::DoDatagramWrite(Byte8 *dataPtr, UInt32 dataLen,
- SocketAddressPtr address) {
- SocketResult error = eSocketNoError;
-
- /* Implement socket callback chain */
- qAssertIfFalse(qIsSocketTypeDatagram(socket->GetSocketType()),
- eSocketErrBadParam, kSocketErrBadParamStr);
-
- qThrowIfError(((DatagramSocketRef) socket)->CallWriteProc(dataPtr, dataLen,
- address), 0);
-
- /* CATCH */
- qCatch();
- return(error);
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DatagramRead(Byte8 *dataPtr, UInt32 dataLen,
- SocketAddressPtr address) {
- SocketResult error = eSocketNoError;
-
- /* Implement socket callback chain */
- qAssertIfFalse(qIsSocketTypeDatagram(socket->GetSocketType()),
- eSocketErrBadParam, kSocketErrBadParamStr);
-
- qThrowIfError(((DatagramSocketRef) socket)->CallReadProc(dataPtr, dataLen,
- address), 0);
-
- /* CATCH */
- qCatch();
- return(error);
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- #pragma mark -
-
- SocketResult NetworkStack::DoStreamServer(UInt32 sessions) {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoStreamClient(SocketAddressPtr address) {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoStreamWrite(Byte8 *dataPtr, UInt32 dataLen) {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::DoStreamClose(Bool8 orderly) {
- return(eSocketNoError); /* Stub function, implementation in derived class */
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::StreamAccept(SocketRef *newSocket,
- SocketAddressPtr address) {
- return(eSocketNoError);
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::StreamRead(Byte8 *dataPtr, UInt32 dataLen) {
- return(eSocketNoError);
- }
-
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
- /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
-
- SocketResult NetworkStack::StreamClosing(Bool8 orderly) {
- return(eSocketNoError);
- }
-
-